package com.gxgeek.repository;

import com.gxgeek.entity.DataRecordEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @author gaoxing
 * @create 2018-06-04 下午4:19
 */
public interface DataRecordRepository extends JpaRepository<DataRecordEntity,String> {

    @Query(nativeQuery = true,
    value = "SELECT * from data_record as record WHERE  record.type =?2 and  record.user_id=?1 order by created_at DESC  LIMIT 1 ")
    DataRecordEntity findLastEntity(String userId, String type);

}
